//============================================================================================
/**
 * @file	bag_bmp.h
 * @brief	バッグ画面BMP処理
 * @author	Hiroyuki Nakamura
 * @date	05.11.28
 */
//============================================================================================
#ifndef BAG_BMP_H
#define BAG_BMP_H
#undef GLOBAL
#ifdef BAG_BMP_H_GLOBAL
#define GLOBAL	/*	*/
#else
#define GLOBAL	extern
#endif


//============================================================================================
//	定数定義
//============================================================================================
// パレット定義
#define	SYS_FONT_PAL	(  4 )		// システムフォント
#define	WINDOW_PAL		( 14 )		// ウィンドウ枠
#define	ICON_PAL		( 13 )		// アイコンパレット
#define	TALKWIN_PAL		( 12 )		// 会話ウィンドウ枠
#define	TALK_FONT_PAL	( 11 )		// 会話フォント

#define BAG_BMP_YESNO_CHAROFFSET	( 1+32*4 )	// 背景のキャラクタファイルである
												// itemBG_D.ncgが32x3キャラで構成
												// されていたから

// どうぐ名表示モード( BagBmp_ItemNamePrintで使います )
enum ITEMPRINT_MODE{
	ITEMPRINT_NORMAL=0,
	ITEMPRINT_INSERT,
} ;

// 会話ウインドウの大きさ指定
enum {
	BAG_TALK_FULL=0,	// 横幅フル
	BAG_TALK_MINI,		// 横幅2/3
};



// BMPデータ
// メニュー情報(下画面の上に表示される
// 1
#define	BMP_MENU_INFO_PX	(  2 )
#define	BMP_MENU_INFO_PY	(  1 )
#define	BMP_MENU_INFO_SX	( 27 )
#define	BMP_MENU_INFO_SY	(  2 )
#define	BMP_MENU_INFO_PAL	( TALK_FONT_PAL )
#define	BMP_MENU_INFO_CGX	( 1 )
#define	BMP_MENU_INFO_FRM	( GF_BGL_FRAME0_S )
// メニュー情報２（木の実ポケット用）
#define	BMP_MENU_INFO2_PX	( 6 )
#define	BMP_MENU_INFO2_PY	( 19 )
#define	BMP_MENU_INFO2_SX	( 13 )
#define	BMP_MENU_INFO2_SY	( 4 )
#define	BMP_MENU_INFO2_PAL	( TALK_FONT_PAL )
#define	BMP_MENU_INFO2_CGX	( BMP_LIST_CGX + BMP_ITEM_W*BMP_ITEM_H*BAG_PAGE_ITEM_NUM )
#define	BMP_MENU_INFO2_FRM	( GF_BGL_FRAME0_S )

// ポケット内のどうぐ数／MAX（?? / ?? )
#define BMP_PAGE_PX		( 10 )
#define BMP_PAGE_PY		( 21 )
#define BMP_PAGE_W		(  7 )
#define BMP_PAGE_H		(  2 )
#define	BMP_PAGE_PAL	( TALK_FONT_PAL )
#define BMP_PAGE_CGX	( BMP_MENU_INFO_CGX + BMP_MENU_INFO_SX*BMP_MENU_INFO_SY )
#define	BMP_PAGE_FRM	( GF_BGL_FRAME0_S )

// 「やめる」
#define BMP_CANCEL_PX	( 25 )
#define BMP_CANCEL_PY	( 21 )
#define BMP_CANCEL_W	(  6 )
#define BMP_CANCEL_H	(  2 )
#define	BMP_CANCEL_PAL	( TALK_FONT_PAL )
#define BMP_CANCEL_CGX	( BMP_PAGE_CGX + BMP_PAGE_W*BMP_PAGE_H )
#define	BMP_CANCEL_FRM	( GF_BGL_FRAME0_S )

// 会話ウィンドウ
#define	BMP_TALK_PX		( 2 )
#define	BMP_TALK_PY		( 1 )
#define	BMP_TALK_SX		( 27 )
#define	BMP_TALK_SY		( 4 )
#define	BMP_TALK_PAL	( TALK_FONT_PAL )
#define	BMP_TALK_CGX	( BMP_CANCEL_CGX + BMP_CANCEL_W * BMP_CANCEL_H )
#define	BMP_TALK_FRM	( GF_BGL_FRAME0_S )

// 追加BMPのキャラ開始位置	241
#define	ADD_SUB_CGX		( BMP_TALK_CGX + BMP_TALK_SX*BMP_TALK_SY )

// アイテムリスト
#define	BMP_LIST_PX		( 14 )
#define	BMP_LIST_PY		( 0 )
#define	BMP_LIST_SX		( 17 )
#define	BMP_LIST_SY		( 18 )
#define	BMP_LIST_PAL	( TALK_FONT_PAL )
#define	BMP_LIST_CGX	( ADD_SUB_CGX )
#define	BMP_LIST_FRM	( GF_BGL_FRAME0_S )

#define BMP_ITEM0_PX	(  4 )
#define BMP_ITEM1_PX	( 20 )
#define BMP_ITEM2_PX	(  4 )
#define BMP_ITEM3_PX	( 20 )
#define BMP_ITEM4_PX	(  4 )
#define BMP_ITEM5_PX	( 20 )

#define BMP_ITEM0_PY	(  5 )
#define BMP_ITEM1_PY	(  5 )
#define BMP_ITEM2_PY	( 10 )
#define BMP_ITEM3_PY	( 10 )
#define BMP_ITEM4_PY	( 15 )
#define BMP_ITEM5_PY	( 15 )

#define BMP_ITEM_W		( 11 )
#define BMP_ITEM_H		(  4 )


// 選択されたどうぐ名	use:572
#define	BMP_SELECTITEM_PAL	( TALK_FONT_PAL )
#define BMP_SELECTITEM_PX	( 12 )
#define BMP_SELECTITEM_PY	(  7 )
#define BMP_SELECTITEM_W	( 11 )
#define BMP_SELECTITEM_H	(  4 )
#define	BMP_SELECTITEM_CGX	( ADD_SUB_CGX + BMP_SELECTITEM_W*BMP_SELECTITEM_H*12 )
#define	BMP_SELECTITEM_FRM	( BMP_LIST_FRM )

// 数字表示BMP定義（１００の桁・１０の桁・１の桁を別々に描画）	use:18
#define BMP_NUM_100_PX	( 16 )
#define BMP_NUM_100_PY	( 14 )
#define BMP_NUM_10_PX	( 20 )
#define BMP_NUM_10_PY	( 14 )
#define BMP_NUM_1_PX	( 24 )
#define BMP_NUM_1_PY	( 14 )
#define BMP_NUM_W		(  2 )
#define BMP_NUM_H		(  3 )
#define BMP_NUM_PAL  	( TALK_FONT_PAL )
#define BMP_NUM_100_CGX	( BMP_SELECTITEM_CGX + BMP_SELECTITEM_W*BMP_SELECTITEM_H )
#define BMP_NUM_10_CGX	( BMP_NUM_100_CGX + BMP_NUM_W*BMP_NUM_H )
#define BMP_NUM_1_CGX	( BMP_NUM_10_CGX + BMP_NUM_W*BMP_NUM_H )
#define	BMP_NUM_FRM		( GF_BGL_FRAME0_S )

// 「すてる」「うる」文字列領域		use:10
#define BMP_DEPOSIT_PX	( 26-8 )
#define BMP_DEPOSIT_PY	( 21 )
#define BMP_DEPOSIT_W	( 5 )
#define BMP_DEPOSIT_H	( 2 )
#define BMP_DEPOSIT_PAL 	( TALK_FONT_PAL )
#define BMP_DEPOSIT_CGX	( BMP_NUM_1_CGX + (BMP_NUM_W*BMP_NUM_H) )
#define	BMP_DEPOSIT_FRM	( GF_BGL_FRAME0_S )

// ここまでで 841

// ４択選択肢			use:80
#define BMP_SELECT0_PX	(  1 )
#define BMP_SELECT0_PY	( 17 )
#define BMP_SELECT1_PX	( 13 )
#define BMP_SELECT1_PY	( 17 )
#define BMP_SELECT2_PX	(  1 )
#define BMP_SELECT2_PY	( 21 )
#define BMP_SELECT3_PX	( 13 )
#define BMP_SELECT3_PY	( 21 )
#define BMP_SELECT_W	( 10 )
#define BMP_SELECT_H	(  2 )
#define	BMP_SELECT_PAL	( TALK_FONT_PAL )
#define BMP_SELECT_CGX	( BMP_DEPOSIT_CGX + BMP_DEPOSIT_W*BMP_DEPOSIT_H )
#define	BMP_SELECT_FRM	( GF_BGL_FRAME0_S )

// どうぐを売る画面用会話ウインドウ		use:72
#define BMP_MINITALK_PX	 ( 11 )
#define BMP_MINITALK_PY	 (  1 )
#define BMP_MINITALK_W	 ( 18 )
#define BMP_MINITALK_H	 (  4 )
#define	BMP_MINITALK_PAL ( TALK_FONT_PAL )
#define BMP_MINITALK_CGX ( BMP_SELECT_CGX )
#define	BMP_MINITALK_FRM ( GF_BGL_FRAME0_S )

// おこづかい	use:36
#define	BMP_GOLD_PX		( 0 )
#define	BMP_GOLD_PY		( 0 )
#define	BMP_GOLD_SX		( 9 )
#define	BMP_GOLD_SY		( 4 )
#define	BMP_GOLD_PAL	( TALK_FONT_PAL )
#define	BMP_GOLD_CGX	( BMP_MINITALK_CGX + BMP_MINITALK_W * BMP_MINITALK_H )
#define	BMP_GOLD_FRM	( GF_BGL_FRAME0_S )

// どうぐを売ったときの金額		use:24
#define BMP_SALE_GOLD_PX	( 24 )
#define BMP_SALE_GOLD_PY	( 14 )
#define BMP_SALE_GOLD_W		(  8 )
#define BMP_SALE_GOLD_H		(  3 )
#define BMP_SALE_GOLD_PAL	( TALK_FONT_PAL )
#define BMP_SALE_GOLD_CGX	( BMP_GOLD_CGX + BMP_GOLD_SX*BMP_GOLD_SY )
#define BMP_SALE_GOLD_FRM	( GF_BGL_FRAME0_S )

// MAX 973 + 会話ウィンドウ 30

// ----------------メイン画面-----------------------
// 説明
//306
#define	BMP_INFO_PX		( 0 )
#define	BMP_INFO_PY		( 18 )
#define	BMP_INFO_SX		( 32 )
#define	BMP_INFO_SY		( 6 )
#define	BMP_INFO_PAL	( SYS_FONT_PAL )
#define	BMP_INFO_CGX	( 1 )
#define	BMP_INFO_FRM	( GF_BGL_FRAME1_M )

#define	BMP_WAZA_INFO_PX		( 0 )
#define	BMP_WAZA_INFO_PY		( 13 )
#define	BMP_WAZA_INFO_SX		( 32 )
#define	BMP_WAZA_INFO_SY		( 4 )
#define	BMP_WAZA_INFO_PAL	( SYS_FONT_PAL )
#define	BMP_WAZA_INFO_CGX	( BMP_INFO_CGX + BMP_INFO_SX*BMP_INFO_SY )
#define	BMP_WAZA_INFO_FRM	( BMP_INFO_FRM )

// ポケット名
//168
#define	BMP_POCKET_PX	( 0 )
#define	BMP_POCKET_PY	( 13 )
#define	BMP_POCKET_SX	( 12 * 3 )
#define	BMP_POCKET_SY	( 3 )
#define	BMP_POCKET_PAL	( SYS_FONT_PAL )
#define	BMP_POCKET_CGX	( BMP_INFO_CGX + BMP_INFO_SX * BMP_INFO_SY )
#define	BMP_POCKET_FRM	( GF_BGL_FRAME3_M )

// 追加BMPのキャラ開始位置
#define	ADD_CGX_NUM		( BMP_TALK_CGX + BMP_TALK_SX * BMP_TALK_SY )

// はい・いいえ
#define	BMP_YESNO_PX	( 23 )
#define	BMP_YESNO_PY	( 13 )
#define	BMP_YESNO_SX	( 7 )
#define	BMP_YESNO_SY	( 4 )
#define	BMP_YESNO_PAL	( SYS_FONT_PAL )
#define	BMP_YESNO_CGX	( ADD_CGX_NUM )
#define	BMP_YESNO_FRM	( GF_BGL_FRAME1_M )
// ５項目メニュー（最大）
#define	BMP_MENU1_PX	( 23 )
#define	BMP_MENU1_PY	( 23 )
#define	BMP_MENU1_SX	( 8 )
#define	BMP_MENU1_SY	( 10 )
#define	BMP_MENU1_PAL	( SYS_FONT_PAL )
#define	BMP_MENU1_CGX	( BMP_YESNO_CGX + BMP_YESNO_SX * BMP_YESNO_SY )
#define	BMP_MENU1_FRM	( GF_BGL_FRAME1_M )
// 捨てる個数選択
#define	BMP_DEL_PX		( 24 )
#define	BMP_DEL_PY		( 19 )
#define	BMP_DEL_SX		( 7 )
#define	BMP_DEL_SY		( 4 )
#define	BMP_DEL_PAL		( SYS_FONT_PAL )
#define	BMP_DEL_CGX		( BMP_MENU1_CGX + BMP_MENU1_SX * BMP_MENU1_SY )
#define	BMP_DEL_FRM		( GF_BGL_FRAME1_M )
// 個数選択（売る）
#define	BMP_SALE_NUM_PX		( 19 )
#define	BMP_SALE_NUM_PY		( 13 )
#define	BMP_SALE_NUM_SX		( 12 )
#define	BMP_SALE_NUM_SY		( 4 )
#define	BMP_SALE_NUM_PAL	( SYS_FONT_PAL )
#define	BMP_SALE_NUM_CGX	( BMP_MENU1_CGX )
#define	BMP_SALE_NUM_FRM	( GF_BGL_FRAME1_M )

// ポルトの数
#define	BMP_PORUTO_PX	( 1 )
#define	BMP_PORUTO_PY	( 12 )
#define	BMP_PORUTO_SX	( 11 )
#define	BMP_PORUTO_SY	( 4 )
#define	BMP_PORUTO_PAL	( SYS_FONT_PAL )
#define	BMP_PORUTO_CGX	( BMP_MENU1_CGX + BMP_MENU1_SX * BMP_MENU1_SY )
#define	BMP_PORUTO_FRM	( GF_BGL_FRAME1_M )

#define	MENU_WIN_CGX_NUM		( 1024 - MENU_WIN_CGX_SIZ )		// メニューウィンドウ枠のCGX
#define	MENU_WIN_PAL			( WINDOW_PAL )					// メニューウィンドウのパレット
#define	TALK_WIN_CGX_NUM		( MENU_WIN_CGX_NUM - TALK_WIN_CGX_SIZ )	// 会話ウィンドウ枠のCGX

#define	TALK_SUB_WIN_CGX_NUM	( 1024 - TALK_WIN_CGX_SIZ )	// メニューウィンドウ枠のCGX

#define	BAGCOL_GREY_F	( 8 )	// 入れ替え時のフォントカラー
#define	BAGCOL_GREY_S	( 9 )	// 入れ替え時のフォント影カラー

#define	BAGCOL_N_BLACK	( GF_PRINTCOLOR_MAKE( 1, 2, 0 ) )		// フォントカラー：黒
#define	BAGCOL_N_WHITE	( GF_PRINTCOLOR_MAKE( 15, 14, 0 ) )		// フォントカラー：白
#define	BAGCOL_B_WHITE	( GF_PRINTCOLOR_MAKE( 15, 1, 0 ) )		// フォントカラー：白
#define	BAGCOL_N_GREY	( GF_PRINTCOLOR_MAKE( 8, 9, 0 ) )		// フォントカラー：灰


//============================================================================================
//	プロトタイプ宣言
//============================================================================================

extern void BagBmpWinSet( BAG_WORK * wk );
extern void BagBmpWinExit( BAG_WORK *wk );
extern void Bag_PocketNameMake( BAG_WORK * wk );
extern void Bag_PocketNameRelease( BAG_WORK * wk );
extern void Bag_PocketNameScreenPut( BAG_WORK * wk );
extern void Bag_PocketNamePut( BAG_WORK * wk );
extern void Bag_ItemInfoPut( BAG_WORK * wk, u16 item );
extern void Bag_NumStrGet( BAG_WORK * wk );
extern void Bag_NumStrRelease( BAG_WORK * wk );
extern void Bag_ItemListNumPut( BAG_WORK * wk, u16 num, u16 y, u32 col );
extern void BagBmp_WazaMachineNoPut( BAG_WORK * wk, GF_BGL_BMPWIN *win, MINEITEM * item, u32 py );
extern void BagBmp_NutsNoPut( BAG_WORK * wk, MINEITEM * item, u32 py );
extern void BagBmp_WazaPageToziruPut( BAG_WORK * wk, u32 py );
extern void BagBmp_WazaMashineInfoPut( BAG_WORK * wk, u16 item );
extern void Bag_MenuStrGet( BAG_WORK * wk );
extern void Bag_MenuStrRelease( BAG_WORK * wk );
extern void Bag_ItemMenuSet( BAG_WORK * wk, u8 * tbl, u8 max );
extern void Bag_ItemMenuExit( BAG_WORK * wk );
extern void BagBmp_ItemChgInfoMsgSet( BAG_WORK * wk );
extern void Bag_DelNumSelWinSet( BAG_WORK * wk );
extern void Bag_DelNumSelWinExit( BAG_WORK * wk );
extern void Bag_SubNumPut( BAG_WORK * wk, int type );
extern void Bag_SubTalkWinSet( BAG_WORK * wk );
extern u8 Bag_TalkMsgPrint( BAG_WORK * wk, int type );
extern void Bag_YesNoSelInit( BAG_WORK * wk );
extern void Bag_SaleNumWinPut( BAG_WORK * wk );
extern void Bag_GoldWinPut( BAG_WORK * wk, u8 flg );
extern void BagBmp_PorutoWinPut( BAG_WORK * wk );

extern void BagBmp_CancelPrint( BAG_WORK *wk, u32 mode );
extern void BagBmp_ItemNamePrint( BAG_WORK *wk, int scr, int pos,  enum ITEMPRINT_MODE mode );
extern void BagBmp_PageNoPrint( BAG_WORK *wk, int max, int scr, int pos );
extern void BagSelectMenu_StringPrint( GF_BGL_BMPWIN *win, STRBUF *string[], const u8 menuitem );
extern void BagBmp_SelectItemPrint( BAG_WORK *wk, int scr, int pos );
extern void BagBmp_SelectItemClear( BAG_WORK *wk );
extern void BagSelectMenu_Clear( GF_BGL_BMPWIN *win );
extern void BagBmp_ItemExplainPut( BAG_WORK *wk, GF_BGL_BMPWIN *win, int item_id);
extern void BagBmp_ItemExplainClear( BAG_WORK *wk, GF_BGL_BMPWIN *win );
extern void BagBmp_PocketExplainPut( BAG_WORK * wk, GF_BGL_BMPWIN * win, int pocket );

extern void BagBmp_ItemMenu2MoveMenu( BAG_WORK *wk );
extern void BagBmp_MenuInfoClear( BAG_WORK *wk );
extern void BagBmp_WazaInfoClear( BAG_WORK *wk );
extern void BagBmp_CancelOff( BAG_WORK *wk );

extern void Bag_YesNoSelEnd( BAG_WORK *wk );
extern void BagBmp_DepositPrint( BAG_WORK *wk );
extern void BagBmp_DepositSaleClear( BAG_WORK *wk );
extern void BagBmp_SalePrint( BAG_WORK *wk );


#undef GLOBAL
#endif	/* BAG_BMP_H */